{extend name="../back" /}
{block name="main"}
<div class="w-100 d-flex justify-content-start align-items-center mb-3">
  <div class="dropdown">
    <button type="button" class="btn btn-dark btn-sm dropdown-toggle" data-bs-toggle="dropdown"><i class="bi-tools mx-1"></i>批量操作</button>
    <div class="dropdown-menu">
      <a class="dropdown-item xf-batch" href="{:xfUrl('blog/admin.index/normal')}"><i class="bi-eye me-1"></i>显示</a>
      <a class="dropdown-item xf-batch" href="{:xfUrl('blog/admin.index/hidden')}"><i class="bi-eye-slash me-1"></i>隐藏</a>
      <li><hr class="dropdown-divider"></li>
      <a class="dropdown-item xf-batch" href="{:xfUrl('blog/admin.index/deletes')}" data-delete="1"><i class="bi-trash me-1 text-danger"></i>删除</a>
    </div>
  </div>
  <div class="btn-group btn-group-sm ms-3" role="group">
    <a class="btn btn-secondary" href="{:xfUrl('blog/admin.index/create')}"><i class="bi-plus mx-1"></i>添加</a>
    <button type="button" class="btn btn-secondary btn-sm dropdown-toggle {in name='query.sortOrder' value='detail_id,detail_weight,detail_view,detail_like,detail_recommend,detail_top,detail_create_time,detail_update_time'}active{/in}" data-bs-toggle="dropdown"><i class="bi-sort-down me-1"></i>排序</button>
    <div class="dropdown-menu">
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_id')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_id'],$query)}">ID值</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_weight')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_weight'],$query)}">权重</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_view')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_view'],$query)}">人气</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_recommend')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_recommend'],$query)}">推荐</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_top')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_top'],$query)}">置顶</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_create_time')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_create_time'],$query)}">添加时间</a>
      <a class="dropdown-item {:xfActive($query['sortOrder'],'detail_update_time')}" href="{:xfUrlFilter('blog/admin.index/index',['sortOrder'=>'detail_update_time'],$query)}">修改时间</a>
    </div>
  </div>
  <div class="dropdown ms-3">
    <button type="button" class="btn btn-secondary btn-sm dropdown-toggle {in name='query.status' value='normal,hidden'}active{/in}" data-bs-toggle="dropdown"><i class="bi-filter mx-1"></i>按状态</button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="{:xfUrl('blog/admin.index/index')}"><i class="bi-list me-1"></i>全部</a>
      <a class="dropdown-item {:xfActive($query['status'],'normal')}" href="{:xfUrlFilter('blog/admin.index/index',['status'=>'normal'],$query)}"><i class="bi-eye me-1"></i>显示</a>
      <a class="dropdown-item {:xfActive($query['status'],'hidden')}" href="{:xfUrlFilter('blog/admin.index/index',['status'=>'hidden'],$query)}"><i class="bi-eye-slash me-1"></i>隐藏</a>
    </div>
  </div>
  <div class="dropdown ms-3">
    <button type="button" class="btn btn-secondary btn-sm dropdown-toggle {in name='query.password' value='null,not null'}active{/in}" data-bs-toggle="dropdown"><i class="bi-key mx-1"></i>按密钥</button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="{:xfUrl('blog/admin.index/index')}"><i class="bi-list me-1"></i>不限制</a>
      <a class="dropdown-item {:xfActive($query['password'],'not null')}" href="{:xfUrlFilter('blog/admin.index/index',['password'=>'not null'],$query)}"><i class="bi-check-circle me-1"></i>有密码</a>
      <a class="dropdown-item {:xfActive($query['password'],'null')}" href="{:xfUrlFilter('blog/admin.index/index',['password'=>'null'],$query)}"><i class="bi-x-circle me-1"></i>无密码</a>
    </div>
  </div>
  <div class="dropdown ms-3">
    <button type="button" class="btn btn-secondary btn-sm dropdown-toggle {gt name='query.typeId' value='0'}active{/gt}" data-bs-toggle="dropdown"><i class="bi-filter me-1"></i>按分类</button>
    <div class="dropdown-menu">
      {volist name="dataType" id="type_name"}
      <a class="dropdown-item {:xfActive($query['typeId'],$key)}" href="{:xfUrlFilter('blog/admin.index/index',['typeId'=>$key],$query)}">{$type_name}</a>
      {/volist}
    </div>
  </div>
  <form class="ms-3" action="{:xfUrl('blog/admin.index/index')}" method="get">
    <div class="input-group input-group-sm">
      <input class="form-control" type="text" name="searchText" placeholder="标题" autocomplete="off" required>
      <button class="btn btn-secondary" type="submit">搜索</button>
    </div>
  </form>
</div>
<table class="table table-striped table-bordered table-hover">
  <thead>
    <tr class="align-middle">
      <th class="td-id"><input name="checkAll" type="checkbox"></th>
      <th class="td-id">ID</th>
      <th>标题</th>
      <th class="td-field">状态</th>
      <th class="td-field">置顶</th>
      <th class="td-field">推荐</th>
      <th class="td-field">私密</th>
      <th class="td-field">权重</th>
      <th class="td-field">人气</th>
      <th class="td-field">首字母</th>
      <th class="td-time">添加时间</th>
      <th class="td-time">修改时间</th>
      <th class="td-op">操作</th>
    </tr>
  </thead>
  <tbody>
    {volist name="data" id="item"}
    <tr class="align-middle">
      <td class="td-id"><input name="id[]" type="checkbox" value="{$item.detail_id}"></td>
      <td class="td-id">{$item.detail_id}</td>
      <td class="td-name align-middle">{$item.detail_name}<small class="pt-1 d-block text-muted">{:xfResultImplode($item['type'],'type_name','type_id')}</small></td>
      <td class="td-field">{eq name="item.detail_status" value="hidden"}<i class="bi-eye-slash text-danger"></i>{else/}<i class="bi-eye"></i>{/eq}</td>
      <td class="td-field">{if $item['detail_top']}<i class="bi-check-circle text-primary"></i>{else/}<i class="bi-x-circle"></i>{/if}</td>
      <td class="td-field">{if $item['detail_recommend']}<i class="bi-check-circle text-primary"></i>{else/}<i class="bi-x-circle"></i>{/if}</td>
      <td class="td-field">{if $item['detail_extend']['password']}<i class="bi-check-circle text-primary"></i>{else/}<i class="bi-x-circle"></i>{/if}</td>
      <td class="td-field">{$item.detail_weight}</td>
      <td class="td-field">{$item.detail_view}</td>
      <td class="td-field">{$item.detail_letter}</td>
      <td class="td-time">{$item.detail_create_time|date='Y-m-d H:i:s'}</td>
      <td class="td-time">{$item.detail_update_time|date='Y-m-d H:i:s'}</td>
      <td class="td-op">
        <a class="px-1 text-danger" href="{:xfUrl('blog/admin.index/delete',['id'=>$item['detail_id']])}" data-toggle="delete">删除</a>
        <a class="px-1 text-dark" href="{:xfUrl('blog/admin.index/edit',['id'=>$item['detail_id']])}" data-toggle="edit">修改</a>
        <a class="px-1 text-primary" href="{:xfUrlDetail($item)}" target="_blank">预览</a>
      </td>
    </tr>
  {/volist}
  </tbody>
</table>
{$pages|raw}
{/block}